import React, { VFC, useEffect, useState} from "react"
import { Select } from 'antd';
const { Option } = Select;
type ItemType = {
    name:string
}
const select:VFC = (props?:any) => {
    const initInfo = {
        name:undefined,
    }
    const {list} = props;
    const [initData, setInitData] = useState<any>([]);
    const [defaultValue, setDefaultValue] = useState<any>('');
    useEffect(()=>{
        if(list){;
            setInitData(list);
            // setDefaultValue(initData[0].name)
        }
    }, [list]);
    const handleChange = () => {

    }
    return (
        <Select labelInValue defaultValue={defaultValue} style={{ width: 120 }} onChange={handleChange}>
            {
                initData.map((item:ItemType,index:number)=>{
                    return <Option value={item.name} key={index}>{item.name}</Option>
                })
            }
        </Select>
    )
}
export default select